package com.woniuxy.controller;

import com.woniuxy.entity.*;
import com.woniuxy.entity.dto.DrugDistributionDTO;
import com.woniuxy.entity.dto.PatientCheckDTO;
import com.woniuxy.service.ICaseService;
import com.woniuxy.service.IDoctorService;
import com.woniuxy.service.IDrugDistributionService;
import com.woniuxy.service.PatientChecklistService;
import com.woniuxy.util.PageParam;
import com.woniuxy.util.ResponseData;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author：xurice
 * @date：Created in 2024/4/12 15:01
 * @description：医生controller
 * @modified By：
 * @version: $
 */
@RestController
@RequestMapping("doctor")
public class DoctorController {
    @Autowired
    IDoctorService doctorService;
    @Autowired
    ICaseService caseService;
    @Autowired
    PatientChecklistService checklistService;
    @Autowired
    IDrugDistributionService drugDistributionService;
    @PostMapping("queryRegistered")
    public ResponseData<?> selectRegistered(@RequestBody PageParam<Registered> pageParam){
        return doctorService.selectRegistered(pageParam);
    }
    @PostMapping("selectCase")
    public ResponseData<?> selectCase(@RequestBody PageParam<Case> pageParam){
        return caseService.selectCase(pageParam);
    }
    @GetMapping("queryDoctor")
    public ResponseData<?> queryDoctor(){
        return doctorService.queryDoctor();
    }
    @GetMapping("queryChecks")
    public ResponseData<?> queryChecks(){
        return doctorService.queryChecks();
    }
    //添加病历
    @PostMapping("addPR")
    public ResponseData<?> addPR(@RequestBody Case patientRecord){
        return caseService.addPatientRecord(patientRecord);
    }
    //添加检查
    @PostMapping("addCheck")
    public ResponseData<?> addCheck(@RequestBody PatientCheckDTO patientCheckDTO){
        return checklistService.addPatientCheck(patientCheckDTO);
    }

    //添加开药表和用药明细表
    @PostMapping("addDrugDistribution")
    public ResponseData<?> addDrugDistribution(@RequestBody DrugDistributionDTO drugDistributionDTO){
        return drugDistributionService.addDrugDistribution(drugDistributionDTO);
    }

    //查找病人信息
    @GetMapping("queryPatient/{id}")
    public ResponseData<?> queryPatient(@PathVariable("id") Integer id){
        return doctorService.queryPatient(id);
    }
}
